<div class="layuimini-container">
    <div class="layuimini-main">
        <table id="currentTable" class="layui-table layui-hide"
               data-auth-add="{:auth('pay.wechat_pay/add')}"
               data-auth-edit="{:auth('pay.wechat_pay/edit')}"
               data-auth-delete="{:auth('pay.wechat_pay/delete')}"
               lay-filter="currentTable">
        </table>
    </div>
</div>

<script type="text/javascript">

require(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'pay.wechat_pay/index',
        add_url: 'pay.wechat_pay/add',
        edit_url: 'pay.wechat_pay/edit',
        delete_url: 'pay.wechat_pay/delete',
        modify_url: 'pay.wechat_pay/modify',
        export_url: 'pay.wechat_pay/export',
    };


            ea.table.render({
                init: init,
                toolbar: ['refresh',
                    [{
                        text: '添加',
                        url: init.add_url,
                        method: 'open',
                        auth: 'add',
                        class: 'layui-btn layui-btn-normal layui-btn-sm',
                        icon: 'fa fa-plus ',
                        extend: 'data-full="true"',
                    }], 'export'],
                cols: [[
                    {field: 'id', minWidth: 80, title: 'ID'},
                    {field: 'name', minWidth: 80, title: '名称'},
                    {field: 'app_id', minWidth: 120, title: 'app_id', edit: 'text'},
                    // {field: 'app_secret', minWidth: 200, title: 'app_secret', edit: 'text'},
                    {field: 'merchant_id', minWidth: 80,search: false, title: '商户号id', edit: 'text'},
                    {field: 'merchant_secret', minWidth: 80, search: false,title: '商户号支付秘钥', edit: 'text'},
                    // {field: 'real_sales', minWidth: 80,search: false, title: '出售数量'},
                    {field: 'is_union', title: '是否使用(唯一)', minWidth: 130, search: 'select', selectList: {0: '是', 1: '否'}, templet: ea.table.switch},
                    {field: 'is_login', title: '是否登录', minWidth: 85, search: 'select', selectList: {0: '是', 1: '否'}, templet: ea.table.switch},
                    {field: 'open_status', title: '是否开启', minWidth: 85, search: 'select', selectList: {0: '是', 1: '否'}, templet: ea.table.switch},
                    {field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
                    {
                        width: 180,
                        title: '操作',
                        templet: ea.table.tool,
                        operat: [
                            [{
                                text: '编辑',
                                url: init.edit_url,
                                method: 'open',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-xs layui-btn-success',
                                extend: 'data-full="true"',
                            }],
                            'delete'
                        ]
                    }
                ]],
            });

            ea.listen();
    
});
</script>